package service.impl;

import common.R;
import mapper.BaseMapper;
import mapper.SingerMapper;
import org.springframework.beans.BeanUtils;
import pojo.Singer;
import pojo.SingerRequest;
import service.SingerService;

public abstract class SingerServiceImpl implements SingerService {
    @Override
    public R addSinger(SingerRequest addSingerRequest) {
        Singer singer = new Singer();
        BeanUtils.copyProperties(addSingerRequest, singer);
        //给出默认头像,后续管理员可以在线修改
        String pic = "https://java-pp.oss-cn-hangzhou.aliyuncs.com/img/singerPic/user.jpg";
        singer.setPic(pic);
        if (BaseMapper.insert(singer) > 0) {
            return R.success("添加成功");
        } else {
            return R.error("添加失败");
        }
    }

}